package trism.trifield.model.helper {
	import trism.game.model.common.stat.cells.CellItem;
	import trism.game.model.common.stat.cells.CellsItem;
	import trism.game.model.common.stat.slots.SlotType;
	import trism.trifield.controller.TrifieldBaseController;
	import trism.trifield.model.TrifieldModel;
	import trism.trifield.model.slots.Slot;
	/**
	 * @author Samoiloff  http://samoiloff.com/
	 */
	public class SlotsHelper extends TrifieldBaseController{
		
		private var _cellsItem : CellsItem;	
		
		
		public function SlotsHelper(model : TrifieldModel) {
			super(model);
			_cellsItem = _model.cellsItem;
		}
		
		public function fillRandomSlots() : void {
			for (var i : int = 0; i < _cellsItem.length; i++) {
				var cellItem : CellItem = _cellsItem.getItemAt(i);
				
				var slot : Slot = new Slot();
				slot.type = getRandomType();
				slot.cellItem = cellItem;

				_view.slots.addItem(slot);
			}
		}
		
//		private function getRandomSlot():Slot {
//			var slot:Slot = new Slot();
//			slot.type = getRandomType();
//			return slot;
//		}
		
		private function getRandomType() : int {
			var types : Array = SlotType.TYPES;
			return types[Math.floor(Math.random()*types.length)];
		}
		
		
	}
}
